import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/containers/Home.vue'
import Dashboard from '@/views/Dashboard.vue'
// import Login from '@/views/Login.vue'
// user
import useChangepwd from '@/views/ui-kits/user/changepwd.vue'
import UserProfile from '@/views/ui-kits/user/profile.vue'
// 接口管理
import InterfaceAdd from '@/views/interfaces/InterfaceAdd.vue'
import InterfaceAdmin from '@/views/interfaces/InterfaceAdmin.vue'
import InterfaceEdit from '@/views/interfaces/InterfaceEdit.vue'
import InterfaceView from '@/views/interfaces/InterfaceView.vue'
import InterfaceList from '@/views/interfaces/InterfaceList.vue'
// 应用管理
import addImpower from '@/views/apply/addImpower.vue'
import applyAddTwo from '@/views/apply/add2.vue'
import applyAddEdit from '@/views/apply/addEdit.vue'
import addAdmin from '@/views/apply/addAdmin.vue'
import applyList from '@/views/apply/list.vue'
//  访问监控
import interfaceUse from '@/views/monitor/interfaceUse.vue'
import innerInterfaceUse from '@/views/monitor/innerInterfaceUse.vue'
import interfaceDetail from '@/views/monitor/interfaceDetail.vue'
import applyUse from '@/views/monitor/applyUse.vue'
import applyDetail from '@/views/monitor/applyDetail.vue'
//系统设置
import deviceConfig from '@/views/monitor/config.vue'
// 懒加载方式，当路由被访问的时候才加载对应组件
const Login = resolve => require(['@/views/Login'], resolve)
Vue.config.silent = true
Vue.use(Router)
let router = new Router({
	routes: [
		{
			path: '/',
			name: '登录',
			component: Login,
			// children: [
			//   {path: '/Login', component: Login,name: '登录'}
			// ]
		},
		{
			path: '/apply/list',
			name: '首页',
			component: Home,
			children: [
				{path: '/apply/list', component: applyList, name: '首页'}
			]
		},
		{
			path: '/user/profile',
			name: '用户管理',
			component: Home,
			children: [
				{path: '/user/profile', component: UserProfile, name: '修改信息',},
				{path: '/user/changepwd', component: useChangepwd, name: '修改密码',}
			]
		},
		{
			path: '/interfaces/InterfaceAdmin',
			name: '接口管理列表',
			component: Home,
			children: [
				{path: '/interfaces/InterfaceList', component: InterfaceList, name: '未授权接口列表',},
				{path: '/interfaces/InterfaceAdd', component: InterfaceAdd, name: '接口添加',},
				{path: '/interfaces/InterfaceEdit', component: InterfaceEdit, name: '接口修改',},
				{path: '/interfaces/InterfaceView', component: InterfaceView, name: '接口查看',},
				{path: '/interfaces/InterfaceAdmin', component: InterfaceAdmin, name: '接口管理',},
			]
		},
		{
			path: '/apply/list',
			name: '应用管理列表',
			component: Home,
			children: [
				{path: '/apply/list', component: applyList, name: '应用列表',},
				{path: '/apply/addImpower', component:addImpower, name: '应用授权'	,},
				{path: '/apply/add2', component: applyAddTwo, name: '创建应用',},
				{path: '/apply/addEdit', component: applyAddEdit, name: '编辑应用',},
				{path: '/apply/addAdmin', component: addAdmin, name: '应用授权管理',},
			]
		},
		{
			path: '/monitor/interfaceUse',
			name: '访问监控',
			component: Home,
			children: [
				{path: '/monitor/interfaceUse', component: interfaceUse, name: '接口使用情况',},
				{path: '/monitor/innerInterfaceUse', component: innerInterfaceUse, name: '内部接口使用情况',},
				{path: '/monitor/interfaceDetail', component: interfaceDetail, name: '接口访问详情',},
				{path: '/monitor/applyUse', component: applyUse, name: '应用使用情况',},
				{path: '/monitor/applyDetail', component: applyDetail, name: '应用使用详情',},
				{path: '/monitor/config', component: deviceConfig, name: '系统设置',},
			]
		}
	]
})

export default router
